<?php
namespace XWAM\Addon\PXCallSystem\Controller;

/**
 * LicenceController 控制器
 * @since 1.0 <2015-6-4> SoChishun <14507247@qq.com> Added.
 */
class LicenceController extends AppbaseController {    

    /**
     * @since 1.0 2014-10-14 by sutroon
     */
    public function licence() {
        $arr = get_licence_data();
        $this->assign('data', $arr);
        $this->display();
    }

    /**
     * @since 1.0 2014-10-14 by sutroon
     */
    public function licence_import_save() {
        $msg = sofn_upload_handle(array('rootPath'=>$_SERVER['DOCUMENT_ROOT'] . '/','savePath' => 'xcallsqzs/Licence/', 'saveName' => 'licence','autoSub'=>false));
        if (is_array($msg)) {
            $arr = get_licence_data();
            // system("/root/test 2 licence.txt");
            if ($arr['username']) {
                $this->success('导入成功',AddonU('Licence/licence'));
            } else {
                $this->error('无效证书',AddonU('Licence/licence'));
            }
        } else {
            $this->error($msg,AddonU('Licence/licence'));
        }
    }
}